package geradordao;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Iana
 */
import java.util.ArrayList;
import java.util.List;

public class BufferConstantesLiteraisString {

    private static int cont = 0;
    private static List<ConstanteLiteralString> stringsLiterais = new ArrayList<ConstanteLiteralString>();

    public static List<ConstanteLiteralString> getStringsLiterais() {
        return stringsLiterais;
    }

    public static void setStringsLiterais(List<ConstanteLiteralString> stringsLiteraisPar) {
        stringsLiterais = stringsLiteraisPar;
    }

    public static void addStringLiteral(String literal) {
        ConstanteLiteralString literalString = new ConstanteLiteralString();
        literalString.setValor(literal);
        literalString.setAlias("buffer" + cont);
        stringsLiterais.add(literalString);
        cont++;
    }

    public static String getAlias(String literal) {
        for (ConstanteLiteralString literalString : stringsLiterais) {
            if (literalString.getValor().equals(literal)) {
                return literalString.getAlias();
            }
        }
        return null;
    }
}
